package com.example.androidkt.first

fun array(){
    val list = ArrayList<String>()

    list.add("apple")
    list.add("banana")
    list.add("Grape")
}

fun main(){
    println()

    val listOf = listOf("apple", "banana","Grape")
    for (fruit in listOf){
        println(fruit)
    }
    println()



    val mutable = mutableListOf("apple", "banana","Grape")
    mutable.add("other")
    for (fruit in mutable){
        println(fruit)
    }

    println()

    //setOf 去重
    val setOf = setOf("apple","apple", "banana","Grape")
    for (fruit in setOf){
        println(fruit)
    }

    println("`````````````````````````````````````````````````````````````")


    val mapOf = mapOf("apple" to 1, "banana" to 2, "zz" to 3)
    for ((a,b) in mapOf){
        println(a)
        println(b)
    }

    println("````````````````````````````````````````````````````````````")
    val hashMapOf = hashMapOf<String, Int>()
    hashMapOf.put("apple",1)
    hashMapOf.put("banana",2)


    val hashMapOf1 = hashMapOf<String, String>()
    hashMapOf1["apple"] = "1"
    hashMapOf1["banana"] = "2"

}

